from tkinter import *

print('Введите начальную координату X:')
x = int(input())
print('Введите начальную координату Y:')
y= int(input())
print('Введите коэффициент увеличения N:')
N = int(input())


def figura(x,y):
    canvas.create_polygon([(0+N*x,0+N*y),(10+N*x,0+N*y),(10+N*x,10+N*y),(20+N*x,10+N*y),(20+N*x,30+N*y),(10+N*x,30+N*y),(10+N*x,20+N*y),(0+N*x,20+N*y), (0+N*x,0+N*y)])
    


if N == 0 and x>=0 and x<=500 and y>=0 and y<=500:
    pass
else:
    if N > 0 and 0*N+x>=0 and 0*N+y>=0 and 20*N+x<=500 and 20*N+y<=500:
        pass
    else:
        if N < 0 and 20*N+x>=0 and 20*N+y>=0 and 0*N+x<=500 and 0*N+y<=500:
            pass
        else:
            print('Размер фигуры превышает максимальный размер поля')
            exit()


root = Tk()
root.title("ИТ марафон")
root.geometry("500x500")

canvas = Canvas(bg="white", width=500, height=500)
canvas.pack(anchor=CENTER, expand=1)

figura(x, y)

root.mainloop()

